﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace 学生选课及成绩查询管理系统
{
    public partial class showStudentGradeInfo : Form
    {
        public showStudentGradeInfo()
        {
            InitializeComponent();
        }

        User user;

        internal User User
        {
            get { return user; }
            set { user = value; }
        }

        private void showStudentGradeInfo_Load(object sender, EventArgs e)
        {
            string sql = "select grade.stuno as '学号',stuname as '学生姓名',course.cname as '课程名',cproperties as '课程性质',score as '分数' from grade" + 
            " join student on grade.stuno=student.stuno "+
            " join course on grade.cno=course.cno "+
            " group by grade.stuno,stuname,course.cname,course.cproperties,grade.score,course.cstate having course.cstate=1 and  grade.stuno=" + user.Username;
            DataTable dt = DBAccess.GetTable(sql);
            dataGridView1.DataSource = dt;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
